<%//@ include file="../include/eproAuthorization.jsp"%>
<%@ page  
	errorPage="../include/eproErrorPage.jsp"
	contentType="text/html; charset=windows-874" 
	import=		"com.epro.standard.frontend.util.FileInfoUtil,
            com.epro.standard.frontend.util.ShowData,java.util.Vector,
            com.softplus.carrefour.hd.bltier.entity.UserOfficeHour,
            com.softplus.carrefour.hd.bltier.entity.UserLevel
            "
%>
<%
  // com.softplus.carrefour.hd.bltier.manage.*
%>
<HTML xmlns:epro>
<%@ taglib uri="/WEB-INF/HeadTag.tld" prefix="head"%>
<%@ taglib uri="/WEB-INF/ToolbarTag.tld" prefix="toolbar"%>
<%@ taglib uri="/WEB-INF/TextfieldTag.tld" prefix="textfield"%>
<%@ taglib uri="/WEB-INF/TextareaTag.tld" prefix="textarea"%>
<%@ taglib uri="/WEB-INF/ListboxTag.tld" prefix="listbox"%>
<%@ taglib uri="/WEB-INF/LovButtonTag.tld" prefix="lovbutton"%>
<%@ taglib uri="/WEB-INF/CheckboxTag.tld" prefix="CheckboxTag"%>

<head:Head 
	author="MAX" 
	title="User's Office Hour(s) Setup : Update"
	import="toolbar,textfield,textarea,listbox,button,checkbox"
	jsFile="../script/imgProp.js,../script/Alert.js,../script/checkValidData.js,../script/lov.js"
	styleFile ="../theme/defaultTheme.css"></head:Head>
<%
    String textfieldWidth 	      = "280";
    String listBoxWidth           = "280" ;
    String lovWidth               = "50";
   	String lovDescWidth   	      = "230";
    String masterWidth            = com.epro.standard.frontend.datasetup.MessageManager.getMasterWidth();
    String linkParameter	        = "" ; //"?countryIDShow="+countryID+"&radioTypeShow="+radioType;

    ShowData         showData 	  = new ShowData();
        
    int              index        = Integer.parseInt(request.getParameter("index")!=null?request.getParameter("index"):"1") - 1 ;
    UserOfficeHour   uhEntity     = (UserOfficeHour) ((Vector)session.getAttribute("OfficeHourManagerVector")).elementAt(index) ;
    UserLevel        ul           = new UserLevel() ;

  	String listboxHours_Data[]    = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",};
    String listboxHours_Label[]   = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",};
    String listboxMinutes_Data[]  = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"};
    String listboxMinutes_Label[] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"};
    
    // ---------------- Display Data ------------------------
    String strIndex         = showData.CheckNull(index) ;
    String countryID        = uhEntity.getCountry().getCountryId() ;
    String countryName      = showData.CheckNull(uhEntity.getCountry().getCountryName()) ;
    String userLevelID      = uhEntity.getComp_id().getUlevel() ;
    String userLevelName    = ul.getLevelName(uhEntity.getComp_id().getUlevel()) ;
    String selectFromHour   = showData.CheckNull(Integer.parseInt(uhEntity.getOprHourStart().substring(0,2))+1) ;
    String selectFromMinute = showData.CheckNull(Integer.parseInt(uhEntity.getOprHourStart().substring(2))+1) ;
    String selectToHour     = showData.CheckNull(Integer.parseInt(uhEntity.getOprHourEnd().substring(0,2))+1) ;
    String selectToMinute   = showData.CheckNull(Integer.parseInt(uhEntity.getOprHourEnd().substring(2))+1) ;
    String sundayCheck      = uhEntity.isSun()?"true":"false" ;
    String mondayCheck      = uhEntity.isMon()?"true":"false" ;
    String tuesdayCheck     = uhEntity.isTue()?"true":"false" ;
    String wednesdayCheck   = uhEntity.isWed()?"true":"false" ;
    String thursdayCheck    = uhEntity.isThu()?"true":"false" ;
    String fridayCheck      = uhEntity.isFri()?"true":"false" ;
    String saturdayCheck    = uhEntity.isSat()?"true":"false" ;
    String updateBy         = showData.CheckNull(uhEntity.getUpdBy()) ;
    String updateDate       = showData.CheckNull(uhEntity.getUpdDate(), "dd/MM/yyyy") ;  
%>
<%//@ include file="../include/eproPopupJsp.jsp"%>

<SCRIPT language="javascript">

    function submitForm()
  	{
      if (showOConfirmDialog("Confirm","Do you want to save?","OK","Cancel") == 1)
      {
        frm.submit() ;
        parent.dialogArguments.location.reload() ;
        parent.window.close() ;
        <%//@include file="../include/eproSaveFormSubmit.jsp"%>
      }
    }
    
    function clearForm()
    {
      frm.reset() ;
      frm.StartTimeHours.options[<%=selectFromHour%>-1].selected		= true ;
      frm.StartTimeMinutes.options[<%=selectFromMinute%>-1].selected	= true ;
      frm.EndTimeHours.options[<%=selectToHour%>-1].selected			= true ;
      frm.EndTimeMinutes.options[<%=selectToMinute%>-1].selected		= true ;
    }

    function confirmBack()
    {
      if (showOConfirmDialog("Confirm","Do you want to back?","OK","Cancel") == 1)
      {
        parent.window.close() ;
      }
    }

</SCRIPT>
<%@ include file="../include/toolbarHint.jsp"%>
<BODY onload="clearForm();">
<DIV style="width:100%;height:90%;margin:5px" class="modalBg">
<%//@ include file="../include/eproPopupToolbar.jsp"%>
   <FORM name="frm" action="../servlet/com.softplus.carrefour.hd.frontend.servlet.administration.CFHDAD04" method="post" onsubmit="submitForm();return false;">
			<INPUT type="hidden" name="action" value="update">
      <INPUT type="hidden" name="index" value="<%=strIndex%>">
			<INPUT type="hidden" name="countryID" value="<%=countryID%>">
			<INPUT type="hidden" name="userLevelID" value="<%=userLevelID%>">
			<TABLE align="center" width="80%">
      
				<TR>
          <TD colspan="2">
            <img alt="<%=saveHint%>" src="../images/icon/toolbar/nSave.gif" onmouseover="this.src='../images/icon/toolbar/oSave.gif'" onmouseout="this.src='../images/icon/toolbar/nSave.gif'" style="cursor:hand" onclick="submitForm();">
            <img alt="<%=clearHint%>" src="../images/icon/toolbar/nClear.gif" onmouseover="this.src='../images/icon/toolbar/oClear.gif'" onmouseout="this.src='../images/icon/toolbar/nClear.gif'" style="cursor:hand" onclick="clearForm();">
            <img alt="<%=exitHint%>" src="../images/icon/toolbar/nExit.gif" onmouseover="this.src='../images/icon/toolbar/oExit.gif'" onmouseout="this.src='../images/icon/toolbar/nExit.gif'" style="cursor:hand" onclick="confirmBack();">
          </TD>
					<TD  align="right"><FONT class="titleFont" color="red">*required field</FONT></TD>
				</TR>
        
			  <TR>
			    <TD width="40%" align="right" valign="top" class="titleFont">Country : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><textfield:textfield  name="countryName" width="<%=textfieldWidth%>" readonly="yes" value="<%=countryName%>"></textfield:textfield></TD>
		    </TR>
          
        <TR>
          <TD align="right" valign="top" class="titleFont">User Level : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><textfield:textfield  name="userLevelName" width="<%=textfieldWidth%>" readonly="yes" value="<%=userLevelName%>"></textfield:textfield></TD>
        </TR>
        
        <TR>
          <TD colspan="3" align="center">
            <FIELDSET class="titleFont" style="text-align: right;width: 430px;margin-left: 58px;"><LEGEND class="borderFontHeadOfWorkingTime">Office Hour(s)</LEGEND>
              <TABLE  width="100%" cellspacing="0" cellpadding="3">
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont">From :</TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <listbox:listbox name="StartTimeHours" data="<%=listboxHours_Data%>" label="<%=listboxHours_Label%>" width="50"></listbox:listbox>
                    &nbsp;  :  &nbsp;
                    <listbox:listbox name="StartTimeMinutes" data="<%=listboxMinutes_Data%>" label="<%=listboxMinutes_Label%>" width="50"></listbox:listbox>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>          
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont">To :</TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <listbox:listbox name="EndTimeHours" data="<%=listboxHours_Data%>" label="<%=listboxHours_Label%>" width="50"></listbox:listbox>
                    &nbsp;  :  &nbsp;
                    <listbox:listbox name="EndTimeMinutes" data="<%=listboxMinutes_Data%>" label="<%=listboxMinutes_Label%>" width="50"></listbox:listbox>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE>
            </FIELDSET>
          </TD>
        </TR>
              
        <TR>
          <TD colspan="3" align="center">
            <FIELDSET class="titleFont" style="text-align: right;width: 430px;margin-left: 58px;"><LEGEND class="borderFontHeadOfWorkingTime">Working Day</LEGEND>
              <TABLE  width="100%" cellspacing="0" cellpadding="3">
                <TR>
                  <TD width="30%" align="right" valign="top" class="titleFont"></TD>
                  <TD width="5"></TD>
                  <TD class="dataDetailPK">
                    <CheckboxTag:checkbox name="workingDay" label="Sunday" value="0" check="<%=sundayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Monday" value="1" check="<%=mondayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Tuesday" value="2" check="<%=tuesdayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Wednesday" value="3" check="<%=wednesdayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Thursday" value="4" check="<%=thursdayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Friday" value="5" check="<%=fridayCheck%>"/><BR>
                    <CheckboxTag:checkbox name="workingDay" label="Saturday" value="6" check="<%=saturdayCheck%>"/><BR>
                  </TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE>
            </FIELDSET>
          </TD>
        </TR>

        <TR>
          <TD align="right" valign="top" class="titleFont">Update By : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><textfield:textfield  name="txtUpdateBy" width="<%=textfieldWidth%>" readonly="yes" value="<%=updateBy%>"></textfield:textfield></TD>
        </TR>
        
        <TR>
          <TD align="right" valign="top" class="titleFont">Update Date : </TD>
          <TD width="5"></TD>
          <TD class="dataDetailPK"><textfield:textfield  name="txtUpdateDate" width="<%=textfieldWidth%>" readonly="yes" value="<%=updateDate%>"></textfield:textfield></TD>
        </TR>
        
      </TABLE>
    </FORM>
</DIV>
</BODY>
</HTML>
